package com.libui.permissions

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
import android.widget.TextView
import com.libui.R

class PermissionView @JvmOverloads constructor(
    context: Context?,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) :
    FrameLayout(context!!, attrs, defStyleAttr) {
    private var mTvTitle: TextView? = null
    private var mTvDesc: TextView? = null

    init {
        initView()
    }

    private fun initView() {
        val permissionView = inflate(context, R.layout.permission_view, this)
        mTvTitle = permissionView.findViewById<View>(R.id.tvTitle) as? TextView
        mTvDesc = permissionView.findViewById<View>(R.id.tvDesc) as? TextView
    }

    fun setTitle(title: String?) {
        mTvTitle?.text = title
    }

    fun setMsg(msg: String?) {
        mTvDesc?.text = msg
    }
}

